package com.ml.mall.entity.detail;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.ml.mall.entity.deduct.SysADeduct;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author kyyang
 * Created 2021-05-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_order_detail")
@ApiModel(value = "SysOrderDetail对象", description = "")
public class SysOrderDetail implements Serializable {


    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_at", fill = FieldFill.INSERT)
    private Date createAt;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "update_at", fill = FieldFill.INSERT_UPDATE)
    private Date updateAt;

    /**
     * 是否删除
     */
    @ApiModelProperty(value = "是否删除")
    @TableField(value = "is_delete", fill = FieldFill.INSERT)
    @TableLogic(value = "0", delval = "1")
    private Integer isDelete;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @TableField("oid")
    private Long oid;

    /**
     * 供销商订单号
     */
    @ApiModelProperty(value = "供销商号")
    @TableField("supplier_id")
    private Long supplierId;

    /**
     * 变体ID
     */
    @ApiModelProperty(value = "变体ID")
    @TableField("variant_id")
    private Long variantId;

    /**
     * 商品数量
     */
    @ApiModelProperty(value = "商品数量")
    @TableField("quantity")
    private Integer quantity;

    /**
     * 商品总价
     */
    @ApiModelProperty(value = "商品总价")
    @TableField("allmoney")
    private BigDecimal allmoney;
    /**
     * 商品提成
     */
    @ApiModelProperty(value = "系统提成")
    @TableField("adapt_fee")
    private BigDecimal adaptFee;
    /**
     * 商品提成
     */
    @ApiModelProperty(value = "税")
    @TableField("tax_fee")
    private BigDecimal taxFee;

    /**
     * 商品单价
     */
    @ApiModelProperty(value = "商品单价")
    @TableField("price")
    private BigDecimal price;

    /**
     * 购买单位
     */
    @ApiModelProperty(value = "购买单位")
    @TableField("buyunit")
    private String buyunit;

    /**
     * 产品ID
     */
    @ApiModelProperty(value = "产品ID")
    @TableField("product_id")
    private Long productId;

    /**
     * 总支付；真实支付金额
     */
    @ApiModelProperty(value = "总支付；真实支付金额")
    @TableField("true_pay")
    private BigDecimal truePay;

    /**
     * 产品ID
     */
    @ApiModelProperty(value = "是否促销：0否；1是")
    @TableField("is_sales")
    private int isSales;

    @ApiModelProperty(value = "促销价格：如果有的话")
    @TableField("sell_price")
    private BigDecimal sellPrice;

    @ApiModelProperty(value = "商品原价")
    @TableField("original_price")
    private BigDecimal originalPrice;

    @ApiModelProperty(value = "促销原价")
    @TableField("original_sell_price")
    private BigDecimal originalSellPrice;

    @ApiModelProperty(value = "商品名")
    @TableField("variant_name")
    private String variantName;

    @ApiModelProperty(value = "图片")
    @TableField("pic_url")
    private String picUrl;

    @ApiModelProperty(value = "卖家编码")
    @TableField("supplier_code")
    private String supplierCode;

    //订单明细创建的时候需要还原订单的原价；sellPrice price 都是经过了提成的
    public void restorePrice(SysADeduct curDeduct) {

    }
}
